package com.mo.ld.activity.interactive

import android.os.Bundle
import android.text.Editable
import android.view.View
import com.mo.ld.bean.DataBindingBean
import com.mo.ld.databinding.ActDatabindingBinding
import com.mo.lib.ui.activity.BaseVbActivity
import com.mo.lib.utils.setClick
import com.mo.lib.utils.showToast

/**
 * @ author：mo
 * @ data：2022/4/26:9:33
 * @ 功能：
 */
class DataBindingActivity : BaseVbActivity<ActDatabindingBinding>() {
    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)
        viewBinding.tvActDatabinding.setClick(500) {
            viewBinding.action?.let {
                viewBinding.action = DataBindingBean("测试", false, it.member + 1)
            } ?: let {
                viewBinding.action = DataBindingBean("测试", false, 10)
            }
        }
        viewBinding.presenter=object :UserPresenter(){
            override fun onUserNameClick(user: DataBindingBean?) {
                super.onUserNameClick(user)
                user?.let {
                    showToast("点击了${user}")
                }?:let {
                    showToast("点击了   user为空")
                }

            }
        }

    }


    override fun initData() {
    }
}

open class UserPresenter {
 open   fun onUserNameClick(user: DataBindingBean?) {
    }

    fun afterTextChanged(s: Editable) {
    }

    fun saveUser(view: View, user: DataBindingBean) {
    }
}